import UploadFiles from 'lib';

let configArray = [
  {
    name: 'test',
    host: '192.168.1.14',
    port: 22,
    username: 'root',
    privateKey: fs.readFileSync('c:/Users/Administrator/.ssh/id_rsa'),
    localPath: './dist',
    remotePath: '/usr/local/nginx/gps',
  },
  {
    name: 'prod',
    host: '120.78.82.60',
    port: 22,
    username: 'root',
    privateKey: fs.readFileSync('c:/Users/Administrator/.ssh/id_rsa'),
    localPath: './dist',
    remotePath: '/www/gps',
  },
];

const args = process.argv.splice(2);

if (args.length) {
  configArray = configArray.filter(i => args.indexOf(i.name) !== -1);
}

if (configArray.length) {
  // eslint-disable-next-line
  new UploadFiles(configArray);
} else {
  console.log('未找到对应服务器配置'.red);
}